<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>flask_wtf渲染注册页面</title>
</head>
<body>
    <h1>注册页面</h1>
    <form method="post",novalidate>
    {% macro print_error(form_fields) %}
        {% for error_message in form_fields %}
            <p class="error" style="color:red;display:inline;">{{error_message}}</p>
        {% endfor %}
    {% endmacro %}

        {{ form.csrf_token }}
        <span>{{ form.username.label }}</span><br>
        {{ form.username }}{{ print_error(form.username.errors) }}<br>
        <span>{{ form.password.label }}</span><br>
        {{ form.password }}{{ print_error(form.password.errors) }}<br>
        <span>{{ form.password2.label }}</span><br>
        {{ form.password2 }}{{ print_error(form.password2.errors) }}<br>
        <p>{{ form.submit }}</p>
    </form>
</body>
</html>